import request from '@/utils/request'

// 获取spu的列表
// GET /admin/product/{page}/{limit}
export function getSpuList(page,limit,category3Id){
    return request({
        url:`/admin/product/${page}/${limit}`,
        method:'GET',
        params:{category3Id}
    })
}



// GET /admin/product/baseTrademark/getTrademarkList
// 品牌数据
export function getTrademarkList(){
    return request({
        url:'/admin/product/baseTrademark/getTrademarkList',
        method:'GET'
    })
}

// 获取平台的全部销售属性（3个）
// GET /admin/product/baseSaleAttrList
export function baseSaleAttrList(){
    return request({
        url:'/admin/product/baseSaleAttrList',
        method:'GET'
    })
}

// GET /admin/product/getSpuById/{spuId}
// 获取spu基本信息
export function getSpuById(spuId){
    return request({
        url:`/admin/product/getSpuById/${spuId}`,
        method:'GET'
    })
}

// 获取spu图片
// GET /admin/product/spuImageList/{spuId}
export function spuImageList(spuId){
    return request({
        url:`/admin/product/spuImageList/${spuId}`,
        method:'GET'
    })
}

// 修改spu的接口
// POST /admin/product/updateSpuInfo
export function updateSpuInfo(data){
    return request({
        url:'/admin/product/updateSpuInfo',
        method:'POST',
        data
    })
}

// 添加spu的接口
// POST /admin/product/saveSpuInfo
export function saveSpuInfo(data){
    return request({
        url:'/admin/product/saveSpuInfo',
        method:'POST',
        data
    })
}
// 删除SPU
// DELETE /admin/product/deleteSpu/{spuId}
export function deleteSpu(spuId){
    return request({
        url:`/admin/product/deleteSpu/${spuId}`,
        method:'DELETE'
    })
}
 
 // 获取销售属性
 // GET /admin/product/spuSaleAttrList/{spuId}
 export function spuSaleAttrList(spuId){
     return request({
         url:`/admin/product/spuSaleAttrList/${spuId}`,
         method:'GET'
     })
 }
 
 // 获取平台属性
 // GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
 export function attrInfoList(ids){
     return request({
         url:`/admin/product/attrInfoList/${ids.category1Id}/${ids.category2Id}/${ids.category3Id}`,
         method:'GET'
     })
 }

// 添加Sku
//  POST /admin/product/saveSkuInfo
export function AddsaveSkuInto(data){
    return request({
        url:'/admin/product/saveSkuInfo',
        method:'POST',
        data
    })
}
// 查看sku列表接口
// GET /admin/product/findBySpuId/{spuId}
export function findBySpuId(spuId){
    return request({
        url:`/admin/product/findBySpuId/${spuId}`,
        method:'GET',
    })
}